php get last date of month

35

$a_date = "2009-11-23";
echo date("Y-m-t", strtotime($a_date));
<?php
   
    // Given a date in string format 
    $getDate = '2022-01-03';
  
    // Converting string to date
    $date = strtotime($getDate);
   
    // Last date of current month.
    $lastGetDate = strtotime(date("Y-m-t", $date ));
  
    // Day of the last date 
    $day = date("l", $lastGetDate);
  
    echo $day;

?>

//Output:

Monday

Comments

Submit
0 Comments